﻿@{
    ViewBag.Title = "取消挂号";
    Layout = "~/Views/Shared/_Index.cshtml";
}
@Html.Partial("_YibaoCommonView")
<style>
    table tr td {
        word-wrap: break-word;
        word-break: break-all;
    }
</style>
<div style="display: flex;flex-direction:row;">
    <section class="panel" style="width:50%;">
        <header class="panel-heading">
            查询卡信息
        </header>
        <div class="panel-body" style="width:100%">
            <div style="display: flex;flex-direction:column;align-items:center;">
                <div style="margin-bottom:10px;width:100%;text-align:center;">
                    <i class="fa fa-address-card-o" style="font-size:40px"></i>
                </div>
                <div style="text-align:center;margin-bottom:20px;">
                    <span id="btn_getcard" class="btn btn-primary" style="height:50px;font-size:25px;">查询卡信息</span>
                </div>
                <div style="text-align:center;margin-bottom:10px;width:100%">
                    <div id="cardinfo" style="border-bottom:1px solid rgb(221, 221, 221);overflow:auto">
                        <table class="table">
                            <tr>
                                <th>证件类型</th>
                                <th>证件号码</th>
                                <th>姓名</th>
                                <th>手机号码</th>
                                <th>居住地</th>
                                <th>社保编号</th>
                                <th>基本帐户余额</th>
                            </tr>
                            <tr>
                                <td id="AAA029_C"></td>
                                <td id="AAE135"></td>
                                <td id="AAC003"></td>
                                <td id="DAC304"></td>
                                <td id="AAE006"></td>
                                <td id="DAC001"></td>
                                <td id="JBZHYE"></td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <section class="panel" style="width:50%;">
        <header class="panel-heading">
            取消医保挂号
        </header>
        <div class="panel-body" style="width:100%">
            <div style="display: flex;flex-direction:column;align-items:center;">
                <div style="margin-bottom:10px;width:100%;text-align:center;">
                    <i class="fa fa-user-times" style="font-size:40px"></i>
                </div>
                <div style="width:70%;margin-bottom:20px;">
                    <input id="jsh" name="jsh" type="text" class="form-control" placeholder="请输入结算号" />
                </div>
                <div style="text-align:center;margin-bottom:10px;">
                    <span id="btn_denyreg" class="btn btn-primary" style="height:50px;font-size:25px;">取消医保挂号</span>
                </div>
                <div style="text-align:center;margin-bottom:10px;">
                    <span id="message" class="btn" style="font-size:15px;color:coral;display:inline-block;width:80%;word-wrap:break-word;white-space:normal;"></span>
                </div>
            </div>
        </div>
    </section>
</div>
<div style="display: flex;flex-direction:row;">
    <section class="panel" style="width:50%;">
        <header class="panel-heading">
            查询医保目录
        </header>
        <div class="panel-body" style="width:100%">
            <div style="display: flex;flex-direction:column;align-items:center;">
                <div style="margin-bottom:10px;width:100%;text-align:center;">
                    <i class="fa fa-folder-open-o" style="font-size:30px"></i>
                </div>
                <div style="width:100%;margin-bottom:10px;display: flex;flex-direction:row;align-items:center;">
                    <input id="DKE085" type="text" class="form-control" placeholder="请输入项目类别" />&nbsp;&nbsp;&nbsp;
                    <input id="DKE166" type="text" class="form-control" placeholder="请输入社保端编码" />
                </div>
                <div style="width:100%;margin-bottom:20px;display: flex;flex-direction:row;align-items:center;">
                    <input id="DKE012" type="text" class="form-control" placeholder="请输入医院端编码" />&nbsp;&nbsp;&nbsp;
                    <input id="AKE002" type="text" class="form-control" placeholder="请输入项目名称" />
                </div>
                <div style="text-align:center;margin-bottom:10px;">
                    <span id="btn_qcatalog" class="btn btn-primary" style="height:50px;font-size:25px;">查询医保目录</span>
                </div>
            </div>
        </div>
    </section>
    <section class="panel" style="width:50%;">
        <header class="panel-heading">
            医保目录
            <i class="fa fa-copy" style="font-size:20px" onclick="Copy(document.getElementById('catalog'));"></i>
        </header>
        <div class="panel-body" style="width:100%">
            <div style="display: flex;flex-direction:column;align-items:center;">
                <div style="margin-bottom:10px;width:100%;text-align:center;height:200px;overflow-y:auto">
                    <span style="word-wrap:break-word;white-space:normal;width:100%;" id="catalog"></span>
                </div>
            </div>
        </div>
    </section>
</div>
<div style="display: flex;flex-direction:row;">
    <section class="panel" style="width:50%;">
        <header class="panel-heading">
            取消HIS挂号
        </header>
        <div class="panel-body" style="width:100%">
            <div style="display: flex;flex-direction:column;align-items:center;">
                <div style="margin-bottom:10px;width:100%;text-align:center;">
                    <i class="fa fa-user-times" style="font-size:40px"></i>
                </div>
                <div style="width:70%;margin-bottom:20px;">
                    <input id="ghmzh" name="ghmzh" type="text" class="form-control" placeholder="请输入HIS门诊号" />
                </div>
                <div style="text-align:center;margin-bottom:10px;">
                    <span id="btn_denyhisreg" class="btn btn-primary" style="height:50px;font-size:25px;">取消HIS挂号</span>
                </div>
            </div>
        </div>
    </section>
    <section class="panel" style="width:50%;">
        <header class="panel-heading">
            医保连通性测试
        </header>
        <div class="panel-body" style="width:100%">
            <div style="display: flex;flex-direction:column;align-items:center;">
                <div style="text-align:center;margin-bottom:10px;">
                    <span id="btn_YibaoConnectedTest" class="btn btn-primary" style="height:50px;font-size:25px;">医保连通性测试</span>
                </div>
            </div>
        </div>
    </section>
</div>
<script type="text/javascript">
    //查询卡信息
    $("#btn_getcard").click(function () {
        $.loading(true);
        setTimeout(function () {
            var card = $.yibao.GetCardInfo(null);
            $.loading(false);
            if (card && card.Code == 0) {
                $("#AAA029_C").html(card.Data.AAA029_C);
                $("#AAE135").html(card.Data.AAE135);
                $("#AAC003").html(card.Data.AAC003);
                $("#DAC304").html(card.Data.DAC304);
                $("#AAE006").html(card.Data.AAE006);
                $("#DAC001").html(card.Data.DAC001);
                $("#JBZHYE").html(card.Data.JBZHYE);
            } else {
                $("#AAA029_C").html("无");
                $("#AAE135").html("无");
                $("#AAC003").html("无");
                $("#DAC304").html("无");
                $("#AAE006").html("无");
                $("#DAC001").html("无");
                $("#JBZHYE").html("无");
            }
        }, 1000);
    });
    //挂号取消
    $("#btn_denyreg").click(function () {
        $("#message").html("");
        var jsh = $("#jsh").val();//结算号
        if (jsh == "") {
            $.modalAlert("结算号不能为空", 'warning');
            return false;
        } else {
            $.loading(true);
            setTimeout(function () {
                var denyreg = $.yibao.DenyReg(jsh);
                $.loading(false);
                if (denyreg && denyreg.Code == 0) {
                    $("#message").html("操作成功");
                } else {
                    $("#message").html(denyreg.ErrorMsg);
                }
            }, 1000);
        }
    });
    //查询医保目录
    $("#btn_qcatalog").click(function () {
        var DKE085 = $("#DKE085").val();//项目类别
        var DKE166 = $("#DKE166").val();//社保端编码
        var DKE012 = $("#DKE012").val();//医院端编码
        var AKE002 = $("#AKE002").val();//项目名称
        if (DKE085 == "") {
            $.modalAlert("项目类别不能为空", 'warning');
            return false;
        }
        if (DKE166 == "" && DKE012 == "" && AKE002 == "") {
            $.modalAlert("社保端编码/医院端编码/项目名称至少有一项", 'warning');
            return false;
        }
        $.loading(true);
        setTimeout(function () {
            var obj = $.yibao.QCatalog(DKE085, DKE166, DKE012, AKE002);
            $.loading(false);
            if (obj) {
                $("#catalog").html(obj);
            }
        }, 1000);
    });
    //拷贝到剪切板
    function Copy(obj) {
        var rng = document.body.createTextRange();
        rng.moveToElementText(obj);
        rng.scrollIntoView();
        rng.select();
        rng.execCommand("Copy");
        rng.collapse(false);
    }
    //取消HIS挂号
    $('#btn_denyhisreg').click(function () {
        var ghmzh = $("#ghmzh").val();//挂号门诊号
        if (!!!ghmzh) {
            $.modalAlert("门诊号不能为空", 'warning');
            return false;
        } else {
            $.najax({
                type: "POST",
                data: {
                    mzh: ghmzh
                },
                url: "/OutpatientManage/OutpatientReg/UnSettedRegBackNum",
                dataType: "json",
                loadingtext: "正在请求HIS取消挂号，请稍后…",
                success: function (ajaxresp) {
                    $.modalAlert('门诊HIS退号成功', 'success');
                    $("#ghmzh").val('');
                    return;
                }
            });
        }
    });
    //医保连通性测试
    $('#btn_YibaoConnectedTest').click(function () {
        $.najax({
            type: "POST",
            url: "/OutpatientManage/OutpatCharge/YibaoConnectedTest",
            dataType: "json",
            loadingtext: "正在请求医保连通性测试，请稍后…",
            success: function (ajaxresp) {
                $.modalAlert('' + JSON.stringify(ajaxresp));
                return;
            }
        });
    });
</script>
